<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ include file="/WEB-INF/jsp/common/page_init.jsp" %>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <title><%=CommonConfig.getString("SYSTEM_TITLE")%></title>
</head>
<body>
<div class="easyui-layout" data-options="fit:true">
    <div data-options="region:'north',border:false" style="height:auto;">
        <div class="title-bt title-item">
            <span class="pl10">主机视图</span>
            <span class="pr10 tr">
              <div class="title-icon-group">
                <a href="#" id="detail" class=""><i class="icon ico-fz"></i></a>
                <a href="#" id="simple" class="second-a"><i class="icon ico-lb"></i></a>
              </div>
            </span>
        </div>
    </div>
    <div data-options="region:'center',border:false" style="padding:5px 5px;background-color: #f8f8f8">
        <div class="engine-panel">
            <div class="main-engine-box">

            </div>
        </div>
    </div>
</div>
</body>
</html>
<script type="text/javascript" src="<%=contextPath%>/js/common/plug-in/tpl/template.js?uuid=<%=RANDOM %>"></script>
<script type="text/html" id="hostTemplate">
    {{ if code >0 }}
        {{ each rows as hostItem index }}
            <div class="engine-column">
                <div class="engine-content">
                    <ul class="engine-list">
                        <li class="engine-header">
                            <div class="engine-heder-left tl fs14">
                                {{ if hostItem.hostStatus==0 }}
                                    <span name="hostStatus" tips="主机未启用" class="engine-heder-title dis-title-unable">
                                        DISABLED
                                    </span>
                                }}
                                {{ else if hostItem.hostStatus==1 && !hostItem.magentStatus  }}
                                    <span name="hostStatus" tips="监控代理程序未启动"  class="engine-heder-title dis-title-excption">
                                        DISCONNECTED
                                    </span>
                                }}
                                {{ else if hostItem.hostStatus==1 && hostItem.magentStatus && hostItem.magentStatus!=1  }}
                                    <span name="hostStatus" tips="{{hostItem.errorMessage}}"  class="engine-heder-title dis-title-excption">
                                        DISCONNECTED
                                    </span>
                                }}
                                {{ else if hostItem.hostStatus==1 && hostItem.magentStatus==1 }}
                                    <span name="hostStatus" tips=""  class="engine-heder-title text-green">
                                        ACTIVE
                                    </span>
                                {{ /if }}
                            </div>
                        </li>
                        <li>
                            <p class="tc pb5 "><a href="#" class="fs14 engine-ip">{{hostItem.hostName}}</a></p>
                        </li>
                        <li class="engine-system-info">
                            <p><i class="icon ico-link "></i> <span>{{hostItem.hostIp}}</span></p>
                            <p><i class="icon ico-bbh"></i>
                                    <span>
                                        {{ hostItem.magentVersion?hostItem.magentVersion:''}}
                                    </span>
                            </p>
                            <p class="engine-system-info-last"><i class="icon ico-xt"></i>
                                <span>
                                     {{ hostItem.host_os?hostItem.host_os+'('+hostItem.host_platform_version+')':''}}
                                </span>
                            </p>
                        </li>
                    </ul>
                    <div name="engine-system-info-box" class="engine-system-info-box">
                        <ul>
                            <li class="engine-system-info info-content">
                                <p> <i class="icon ico-cpu"></i>
                                    <span>
                                        {{ hostItem.cpu_cores?hostItem.cpu_modelname+'('+hostItem.cpu_count+')':''}}
                                    </span> <span></span> </p>
                                <%--<div class="progressbar-bg"> <span class="progressbar-act" ></span> </div>--%>
                                <%--<span class="text-green">{{hostItem.disk_used_percent}}</span>--%>
                            </li>
                            <li class="engine-system-info info-content">
                                <p> <i class="icon ico-ram"></i> <span>{{ hostItem.mem_total?hostItem.mem_total:0 }}GiB</span> <span></span> </p>
                                <div class="progressbar-bg" >
                                    <span class="progressbar-act" style="width:{{ hostItem.mem_used_percent?hostItem.mem_used_percent+'%':0+'%' }}"></span> </div>
                                <span class="text-green">{{ hostItem.mem_used_percent?hostItem.mem_used_percent:0 }}%</span>
                            </li>
                            <li class="engine-system-info info-content">
                                <p> <i class="icon ico-yp"></i> <span>{{ hostItem.disk_total_gb?hostItem.disk_total_gb:0 }}GiB</span> <span></span> </p>
                                <div class="progressbar-bg" >
                                    <span class="progressbar-act" style="width:{{ hostItem.disk_used_percent?hostItem.disk_used_percent+'%':0+'%' }}"></span> </div>
                                <span class="text-green">{{ hostItem.disk_used_percent?hostItem.disk_used_percent:0 }}%</span>
                            </li>
                            <li class="engine-system-result tl">
                            {{ if hostItem.nodeStatusList && hostItem.nodeStatusList.length>0 }}
                                {{ each hostItem.nodeStatusList as nodeItem index }}
                                    <span id="{{nodeItem.node_code}}" style="position: relative;" name="nodeStatus" tips="{{nodeItem.result_note}}"><i class="icon ico-yd {{nodeItem.result_code==1?'text-green':'text-orange'}}"></i></span>
                                {{ /each }}
                            {{/if}}
                            </li>
                        </ul>
                    </div>
                </div>
            </div>
        {{ /each }}
    {{ else }}
    {{ /if }}
</script>
<script type="text/javascript" src="<%=contextPath%>/js/console/host/hostMonitor.js?uuid=<%=RANDOM %>"></script>